<!--Copyright (C) Kherty.  All rights reserved.-->
<ResourceDictionary
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    x:Class="OpenLS.UI.Themes.ApplicationMenuResources"
  xmlns:os="clr-namespace:OpenLS.UI"
  xmlns:ouit="clr-namespace:OpenLS.UI.Themes"
  xmlns:oui="http://schemas.Kherty.com/office/2007"
    
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    >
    <ResourceDictionary.MergedDictionaries>
        <ouit:MenuResources/>
        <ouit:ApplicationMenuFooterButtonResources/>
    </ResourceDictionary.MergedDictionaries>
    <ControlTemplate x:Key="applicationMenuTemplate" TargetType="{x:Type os:ApplicationMenu}">
        <Grid Background="{x:Null}">
            <Grid VerticalAlignment="Bottom">
           <!-- <Rectangle Grid.Row="1" x:Name="lightRect"  Fill="{TemplateBinding Background}" 
                Visibility="Visible" HorizontalAlignment="Stretch" Height="22"/> -->
                <Border Grid.Row="1" x:Name="rightRect" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}"
                       CornerRadius="4 4 0 0" Visibility="Visible" HorizontalAlignment="Stretch" Height="22"  Padding="{TemplateBinding Padding}">
                    <ContentPresenter Grid.Row="1" x:Name="HeaderHost" 
                              ContentSource="Header" VerticalAlignment="Center" HorizontalAlignment="Stretch"/>
                </Border>
                <!--
            <ContentControl Grid.Row="1" x:Name="HeaderHost"  Background="Red" Padding="3 0 3 0"
                              Content="{TemplateBinding Header}" VerticalAlignment="Center" HorizontalAlignment="Stretch"/>
-->
            <ContentPresenter RecognizesAccessKey="True" ContentSource="AccessKey" TextElement.Foreground="Transparent"/>
            </Grid>
            <DockPanel x:Name="ContentPanel" Margin="1">
                <Popup x:Name="SubMenuPopup" VerticalOffset="1" HorizontalOffset="-2"
               Placement="Bottom" IsOpen="{Binding Path=IsSubmenuOpen,RelativeSource={RelativeSource TemplatedParent}}"
               Focusable="False" MinWidth="400">
                    <Border Name="outerBorder" BorderThickness="1" CornerRadius="2" Background="White" BorderBrush="{DynamicResource {x:Static oui:OfficeBrushes.ApplicationMenuOuterBorderBrushKey}}">
                        <Border Name="innerBorder" BorderThickness="1" CornerRadius="2" BorderBrush="{DynamicResource {x:Static oui:OfficeBrushes.ApplicationMenuInnerBorderBrushKey}}">
                            <DockPanel>
                                <Grid DockPanel.Dock="Bottom" MinHeight="32">
                                    <Grid.Resources>
                                        <Style TargetType="{x:Type Button}" BasedOn="{StaticResource ApplicationMenuFooterButtonStyle}"/>
                                    </Grid.Resources>
                                    <Rectangle Fill="{DynamicResource {x:Static oui:OfficeBrushes.ApplicationMenuFooterBackgroundKey }}"></Rectangle>
                                    <ContentPresenter ContentSource="Footer"/>
                                </Grid>
                                <ItemsPresenter DockPanel.Dock ="Left" Margin="{TemplateBinding Padding}" KeyboardNavigation.DirectionalNavigation="Cycle" />
                                <Grid>
                                    <Rectangle Fill="{DynamicResource {x:Static oui:OfficeBrushes.ApplicationMenuRightPaneBackgroundKey}}"/>
                                    <ContentPresenter ContentSource="RightContent" />
                                </Grid>
                            </DockPanel>
                        </Border>
                    </Border>
                </Popup>
            </DockPanel>
        </Grid>
        <ControlTemplate.Triggers>
            <Trigger Property="IsHighlighted" Value="True">
              <!--  <Setter Property="Fill" Value="{DynamicResource {x:Static oui:OfficeBrushes.ApplicationMenuButtonHoverBackgroundKey}}" TargetName="lightRect"/> -->
                <Setter Property="BorderBrush" Value="Silver" />
                <Setter Property="oui:HighlightElement.IsHighlighted" Value="True" />
            </Trigger>
            <Trigger Property="IsOpen" Value="True" SourceName="SubMenuPopup">
               <!-- <Setter Property="Fill" Value="{DynamicResource {x:Static oui:OfficeBrushes.ApplicationMenuButtonPressedBackgroundKey}}" TargetName="lightRect"/> -->
              <!--  <Setter Property="Visibility" Value="Visible" TargetName="lightRect"/> -->
            </Trigger>

            <!-- <Trigger Property="HasDropShadow" Value="True">
        <Setter Property="FrameworkElement.Margin" TargetName="Shdw" Value="0,0,5,5"/>
        <Setter Property="mwt:SystemDropShadowChrome.Color" TargetName="Shdw" Value="#71000000"/>
      </Trigger> -->
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <Style TargetType="{x:Type os:ApplicationMenu}">
        <Setter Property="Template" Value="{StaticResource applicationMenuTemplate}">
        </Setter>
        <Setter Property="Background">
            <Setter.Value>
                <LinearGradientBrush EndPoint="0 0" StartPoint="0 1">
                    <GradientStop Color="#FF297D2C" Offset="1"/>
                    <GradientStop Color="#FF56BB2A" Offset="0"/>
                </LinearGradientBrush>
            </Setter.Value>
        </Setter>
        <Setter Property="BorderBrush" Value="DarkGreen">
            
        </Setter>
        <Setter Property="Padding" Value="12 0 12 0"></Setter>
        
        <Setter Property="Foreground" Value="White"></Setter>
      <!--  <Setter Property="Command" Value="{x:Static os:OfficeApplicationCommands.Exit}"/> -->
    </Style>

</ResourceDictionary>